package com.wing.wcabinet.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 权限管理表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("wcab_authority_manage")
public class WauthorityManage extends BaseEntity<WauthorityManage> implements Serializable {

    private static final long serialVersionUID = 1L;


    public enum AstrictMaterial implements IEnum<Integer> {

        /**
        * 不限制
        */
        noAstrict(0,"不限制"),
        /**
        * 限制
        */
        astrict(1,"限制");

        private int code;
        private String desc;

        AstrictMaterial(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }


    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 权限组名称
     */
    private String name;

    /**
     * 可领物资分类id
     */
    private String materialId;


    /**
     * 刀具柜Id
     */
    private Long cabinetId;

    /**
     * 状态  0正常  1停用
     */
    private Long status;

    /**
     * 刀具柜编码
     */
    private String cabinetCode;


    public enum RestrictWay implements IEnum<Integer> {
        /**
         * 按分类
         */
        category(0,"按分类"),
        /**
         * 按物料
         */
        materiel(1,"按物料");

        private int code;
        private String desc;

        RestrictWay(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }
    /**
     * 限制方式
     */
    private RestrictWay restrictWay;

    /**
     * 限制方式描述
     */
    @TableField(exist = false)
    private String restrictWayDesc;

    public String getRestrictWayDesc() {
        return restrictWay == null ? null : restrictWay.getDesc();
    }

}
